<!doctype html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>期末玩耍计算器</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    
	
	
	<style>
		body{text-align:center} 
		
		#icon_1{
			margin-top: 100px;
			margin-left: 38%;
			
		}
		
		#icon_2{
			width: 222px;	
			text-align:center;
		}
		
		#but{
			margin-top: 100px;
		}
		
		
	</style>
  </head>
  
  
  <body >
	  <h1 align="center" >期末玩耍计算器</h1>
	  <h2 align="center" >如果ber学校采用的是{平时成绩}与{期末成绩}作为【最终成绩】的评分方式，那么你可以测试你接下来的日子是否可以放心玩耍。</h2>
	  
	<form name="a">
		<div class="input-group" id="icon_1">
			
		  <span class="input-group-addon" id="basic-addon1">平时成绩分数</span>
		  <input type="text" class="form-control" placeholder="这里输入你平时成绩" aria-describedby="basic-addon1" id="icon_2" name="last_grade" > 
		 </div>
		 <div class="input-group" id="icon_1">
		  <span class="input-group-addon" id="basic-addon1">平时成绩占比</span>
		  <input type="text" class="form-control" placeholder="格式:若占比60%输入[0.6]" aria-describedby="basic-addon1" id="icon_2" name="last_bf">
		</div>
		
		
		<input type="submit" class="btn btn-default" value="提交" id="but" onclick="check()">	
	</form>
    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
  
	<script>
		
		
		function check(){ 
			    if( a.last_grade.value==""){
			        alert("请输入您的平时成绩！"); a.last_grade.focus(); return;
			    }else if(a.last_bf.value=="") {
					alert("请输入您的平时成绩占比！");a.last_bf.focus();return;
				}else{
			        document.a.submit();
					
					var v1 = document.a.last_grade.value;
					var v2 = document.a.last_bf.value;
					var v3 = 1-v2 ;
					var gd = 60 - v2*v1;
					var x = gd/v3;
					var v22 = v2*100 +'%';
					alert("获取到输入的内容：\n平时成绩为["+v1+"]\n平时成绩占比为["+v2+"]"+"("+v22+")"+"\n默认总百分比为100%，进一步确认获得结果！")
					
					
					
					
					alert("你的期末至少需要考到【"+x+"】分才能及格。 \n 建议放心地玩。")
					
					
					
					
			    }
			}
			
	
	</script>
  </body>
</html>